home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_10_10
/
1010016a
< prev
next >
Wrap
Text File
|
1992-08-11
|
382b
|
19 lines
Listing 4 -- the file strncat.c
/* strncat function */
#include <string.h>
char *(strncat)(char *s1, const char *s2, size_t n)
{ /* copy char s2[max n] to end of s1[] */
char *s;
for (s = s1; *s != '\0'; ++s)
; /* find end of s1[] */
for (; 0 < n && *s2 != '\0'; --n)
*s++ = *s2++; /* copy at most n chars from s2[] */
*s = '\0';
return (s1);
}